import java.io.IOException;
import java.util.StringTokenizer;

public class Main{

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		java.io.BufferedReader r = new java.io.BufferedReader(
				new java.io.InputStreamReader(System.in));

		int number = Integer.parseInt(r.readLine());
		for (int i1 = 0; i1 < number; i1++) {
			StringTokenizer tokenizer = new StringTokenizer(r.readLine());
			int n = Integer.parseInt(tokenizer.nextToken());
			String s = tokenizer.nextToken();
			System.out.println((i1 + 1) + " " + s.substring(0, n - 1)
					+ s.substring(n));
		}
	}

}
